package com.sync.platform.service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.extension.service.IService;
import com.sync.platform.entity.DatabaseConfig;

/**
 * Database configuration service interface
 */
public interface DatabaseConfigService extends IService<DatabaseConfig> {

    /**
     * Test database connection
     *
     * @param databaseConfig Database configuration
     * @return true if connection successful, false otherwise
     */
    boolean testConnection(DatabaseConfig databaseConfig);

    /**
     * Update database status
     *
     * @param id Database ID
     * @param status Database status
     * @return true if update successful, false otherwise
     */
    boolean updateStatus(Long id, Integer status);

    /**
     * Get database tables
     *
     * @param id Database ID
     * @return List of table names
     */
    List<String> getTables(Long id);

    /**
     * Get table columns
     *
     * @param id Database ID
     * @param tableName Table name
     * @return Map of column name to column type
     */
    List<Map<String, String>> getColumns(Long id, String tableName);

    /**
     * Execute query on database
     *
     * @param id Database ID
     * @param sql SQL query
     * @return Query results
     */
    List<Map<String, Object>> executeQuery(Long id, String sql);

    DatabaseConfig getDatabaseConfig(Long id);
    
    /**
     * Count total number of databases
     * 
     * @return count of databases
     */
    int countDatabases();
}
